﻿package mortal.game.view.battlefield
{
    import Message.Public.*;
    import com.mui.containers.*;
    import com.mui.containers.globalVariable.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import mortal.common.global.*;
    import mortal.game.cache.battlefield.*;
    import mortal.game.resource.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;

    public class BattlefieldResultCellRenderer extends GCellRenderer
    {
        private var _selfBg:ScaleBitmap;
        private var _box:GBox;
        private var _tfRank:GTextFiled;
        private var _tfName:GTextFiled;
        private var _tfComat:GTextFiled;
        private var _tfForce:GTextFiled;
        private var _tfKill:GTextFiled;
        private var _tfAssists:GTextFiled;
        private var _tfBeKill:GTextFiled;
        private var _tfFightHonor:GTextFiled;
        private var _tfAccountHonor:GTextFiled;
        private var _tfBlessHonor:GTextFiled;
        private var _tfTotalHonor:GTextFiled;
        private var _tfVIPHonor:GTextFiled;
        private var _line:ScaleBitmap;

        public function BattlefieldResultCellRenderer()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._selfBg = UIFactory.bg(0, -2, 780, 32, this, ImagesConst.selectFilter);
            this._selfBg.visible = false;
            this._box = UIFactory.getUICompoment(GBox);
            this._box.direction = GBoxDirection.HORIZONTAL;
            UIFactory.setObjAttri(this._box, 0, 4, -1, -1, this);
            this._tfRank = UIFactory.gTextField("", 0, 0, 60, 20, this._box, GlobalStyle.textFormatBai.center());
            this._tfName = UIFactory.gTextField("", 0, 0, 130, 20, this._box, GlobalStyle.textFormatBai.center());
            this._tfComat = UIFactory.gTextField("", 0, 0, 70, 20, this._box, GlobalStyle.textFormatBai.center());
            this._tfForce = UIFactory.gTextField("", 0, 0, 50, 20, this._box, GlobalStyle.textFormatBai.center());
            this._tfKill = UIFactory.gTextField("", 0, 0, 50, 20, this._box, GlobalStyle.textFormatLv.center());
            this._tfAssists = UIFactory.gTextField("", 0, 0, 55, 20, this._box, GlobalStyle.textFormatLv.center());
            this._tfBeKill = UIFactory.gTextField("", 0, 0, 55, 20, this._box, GlobalStyle.textFormatLv.center());
            this._tfFightHonor = UIFactory.gTextField("", 0, 0, 65, 20, this._box, GlobalStyle.textFormatBai.center());
            this._tfAccountHonor = UIFactory.gTextField("", 0, 0, 65, 20, this._box, GlobalStyle.textFormatBai.center());
            this._tfBlessHonor = UIFactory.gTextField("", 0, 0, 65, 20, this._box, GlobalStyle.textFormatBai.center());
            this._tfVIPHonor = UIFactory.gTextField("", 0, 0, 65, 20, this._box, GlobalStyle.textFormatBai.center());
            this._tfTotalHonor = UIFactory.gTextField("", 0, 0, 67, 20, this._box, GlobalStyle.textFormatBai.center());
            this._line = UIFactory.bg(0, 28, 780, 2, this, "SplitLine");
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._selfBg.dispose(param1);
            this._selfBg = null;
            this._box.dispose(param1);
            this._box = null;
            this._tfRank = null;
            this._tfName = null;
            this._tfComat = null;
            this._tfForce = null;
            this._tfKill = null;
            this._tfAssists = null;
            this._tfBeKill = null;
            this._tfFightHonor = null;
            this._tfAccountHonor = null;
            this._tfBlessHonor = null;
            this._tfVIPHonor = null;
            this._tfTotalHonor = null;
            this._line.dispose(param1);
            this._line = null;
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            var _loc_2:* = param1 as BattlefieldResult;
            this._tfRank.text = _loc_2.rank.toString();
            this._tfName.text = NameUtil.getProxyName(_loc_2.score.entityId, true) + _loc_2.score.name.toString();
            this._tfComat.text = _loc_2.score.combat.toString();
            this._tfForce.htmlText = GameDefConfig.instance.getBattlefieldForceHtml(_loc_2.score.force);
            this._tfKill.text = _loc_2.score.killPlayer.toString();
            this._tfAssists.text = _loc_2.score.assist.toString();
            this._tfBeKill.text = _loc_2.score.beKilled.toString();
            this._tfFightHonor.text = _loc_2.score.honor.toString();
            this._tfAccountHonor.text = _loc_2.score.forceHonor.toString();
            this._tfBlessHonor.text = _loc_2.score.taskHonor.toString();
            var _loc_3:* = VipConfig.instance.getValueByTypeAndLv(EVipRecordType._EVipRecordTypeBattlehonour, _loc_2.score.vipLv);
            if (_loc_3)
            {
                this._tfVIPHonor.text = _loc_3;
            }
            else
            {
                this._tfVIPHonor.text = "0";
            }
            this._tfTotalHonor.text = (_loc_2.score.totalHonor + int(_loc_3)).toString();
            this._box.resetPosition2();
            this._selfBg.visible = EntityUtil.isSelf(_loc_2.score.entityId);
            return;
        }// end function

    }
}
